package com.yw.smartcityforjava.api;

import com.yw.smartcityforjava.App;

import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;

public class ServiceCreator {

    private static ServiceCreator instance = new ServiceCreator();
    private  Retrofit retrofit;
    private ServiceCreator(){
        retrofit = new Retrofit.Builder()
                .baseUrl(App.baseUrl)
                .addConverterFactory(GsonConverterFactory.create())
                .build();
    }

    public static ServiceCreator getInstance(){
        return instance;
    }

    /*public  <T> T create(Class<T> serviceClass){
        return retrofit.create(serviceClass);
    }*/

    public Api getApi(){
        return retrofit.create(Api.class);
    }


}
